<?php
/*
 * Creative Bulletin Board Generation 3
 * Version 1.0 Beta 1
 +------------------------------------
 * Forum Application Controller: Category
 * Started: Sat Oct 24, 9:38 AM
 * Script version: 1.0
 */
class category{
	public function __construct($identifier){
		global $_CF;
		$this->cid = intval($identifier);
		$this->query = $_CF->db->select("categories", "*", "1", " WHERE `id` = '{$this->cid}'");
		if(!$this->query){
			$this->status = false;
		}
		else{
			$this->status = true;
			$this->cat = $_CF->db->fetch_array($this->query);
		}
	}
	
	public function getStatus(){
		return $this->status;
	}
	
	public function getName(){
		return $this->cat['name'];
	}
	
	public function getID(){
		return $this->cat['id'];
	}
	
	public function getOrder(){
		return $this->cat['order'];
	}
	
	public function getDesc(){
		return $this->cat['description'];
	}

	public function delete(){
		global $db;
		$query = $db->query("DELETE FROM `".DB_PREFIX."categories` WHERE `id` = {$this->cid} LIMIT 1");
		return $query;
	}
}
